#!/bin/zsh

# workspace的位置.
workspaceFilePath="MixedPlayerSdkDemo_dev.xcworkspace"
# Release or Debug
configuration="Release"
# 要使用的xcodebuild的路径.
xcodebuild="/Applications/Xcode_13.app/Contents/Developer/usr/bin/xcodebuild"
# targetName
targetName="MixedPlayerSdk"

function generateCmd() {
    cmd="${xcodebuild} archive"
    # 指定workspace
    cmd+=" -workspace ${workspaceFilePath}"
    # 指定configuration
    cmd+=" -configuration ${configuration}"
    # 指定targetName
    cmd+=" -scheme ${targetName}"

    #这个就是xcode中,选择目标
    cmd+=" -destination=\"Any iOS Device\""

    # archive文件的path,1.xcarchive,默认放在DerivedData/${ProjectName}/Build/Products/Release-iphoneos/中.
    # cmd+=" -exportArchive -exportPath ./output"
    # cmd+=" -archivePath ./archive/1"

    cmd+=" -sdk iphoneos clean build  SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES"
    echo ${cmd}
}

function main() {
    cmd=`generateCmd`
    echo "cmd is: ${cmd}"
    eval "${cmd}"   
}

main